class ColegiotypesController < ApplicationController
  # GET /colegiotypes
  # GET /colegiotypes.xml
  def index
    @colegiotypes = Colegiotype.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @colegiotypes }
    end
  end

  # GET /colegiotypes/1
  # GET /colegiotypes/1.xml
  def show
    @colegiotype = Colegiotype.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @colegiotype }
    end
  end

  # GET /colegiotypes/new
  # GET /colegiotypes/new.xml
  def new
    @colegiotype = Colegiotype.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @colegiotype }
    end
  end

  # GET /colegiotypes/1/edit
  def edit
    @colegiotype = Colegiotype.find(params[:id])
  end

  # POST /colegiotypes
  # POST /colegiotypes.xml
  def create
    @colegiotype = Colegiotype.new(params[:colegiotype])

    @colegiotype = modifica @colegiotype,params[:colegiotype]

    respond_to do |format|
      if @colegiotype.save
        flash[:notice] = 'Colegiotype was successfully created.'
        format.html { redirect_to(colegiotypes_url) }
        format.xml  { render :xml => @colegiotype, :status => :created, :location => @colegiotype }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @colegiotype.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /colegiotypes/1
  # PUT /colegiotypes/1.xml
  def update
    @colegiotype = Colegiotype.find(params[:id])

    respond_to do |format|
      if @colegiotype.update_attributes(params[:colegiotype])
        flash[:notice] = 'Colegiotype was successfully updated.'
        format.html { redirect_to(colegiotypes_url) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @colegiotype.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /colegiotypes/1
  # DELETE /colegiotypes/1.xml
  def destroy
    @colegiotype = Colegiotype.find(params[:id])
    @colegiotype.destroy

    respond_to do |format|
      format.html { redirect_to(colegiotypes_url) }
      format.xml  { head :ok }
    end
  end
end
